import 'package:flutter/material.dart';
import 'package:flutter_default_project/models.dart';

import '../typedefs.dart';

class TodoItem extends StatelessWidget {
  final Todo todo;
  final TodoUpdater updateTodo;
  const TodoItem({super.key, required this.todo, required this.updateTodo});

  @override
  Widget build(BuildContext context) {
    return ListTile(
      title: Text(todo.task),
      subtitle: Text(todo.note),
      leading: Checkbox(
        value: todo.complete,
        onChanged: (value) {
          updateTodo(todo, complete: value);
        },
      ),
    );
  }
}
